//
//  QSHomeEntranceSliderView.m
//  DigitalEconomy_iOS
//
//  Created by SUNJUN on 2020/4/25.
//  Copyright © 2020 SUNJUN. All rights reserved.
//

#import "QSHomeEntranceSliderView.h"

@interface QSHomeEntranceSliderView ()

@property (nonatomic, strong) UIView *sliderView;

@end

@implementation QSHomeEntranceSliderView

- (instancetype)initWithFrame:(CGRect)frame {
  if (self = [super initWithFrame:frame]) {
    self.backgroundColor = [UIColor colorWithHexString:@"#E0E2EA"];
    self.layer.cornerRadius = 2;
    [self configureViews];
  }
  return self;
}

- (void)configureViews {
  self.sliderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, kRealValue(4.f))];
  self.sliderView.backgroundColor = [UIColor colorWithHexString:@"#128BEC"];
  self.sliderView.layer.cornerRadius = 2;
  [self addSubview:self.sliderView];
}

- (void)updateSliderViewWithPercent:(CGFloat)percent {
  if (percent > 1) {
    percent = 1;
  }
  if (percent < 0) {
    percent = 0;
  }
  self.sliderView.width = percent * self.width;
}

@end
